<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>

<div id="app">
  <div v-if="books.length">
    <table>
    <thead>
    <tr>
      <th></th>
      <th>番名</th>
      <th>发行日期</th>
      <th>价格</th>
      <th>数量</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr v-for="(item,index) in books">
      <td>{{item.id}}</td>
      <td>{{item.name}}</td>
      <td>{{item.date}}</td>
      <td>{{item.price| showprice }}</td>
      <td>
        <button @click="incre(index)" >+</button>
        {{item.count}}
        <button @click="decre(index)" :disabled="item.count==1">-</button>
      </td>
      <td><button @click="removehandler(index)">移除</button></td>
    </tr>
    </tbody>


    </table>
    <h2>总价格：{{totalprice}}</h2>
  </div>
  <h1 v-else>空</h1>

</div>

<script src="../../js/vue.js"></script>
<script src="main.js"></script>

</body>
</html>